package com.xywy.tangandroid.bean;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;


public class User extends BaseHttpResponse {
	
	private static User user;
    private  int state;
    private  String userid;
	private String isregister;
	private String phonenum;
	private int height;
	private String sex;
	private String birthday;
	private String accountstr;
	
	private static SharedPreferences sp;//将登录信息存到文件中
	
	public String getAccountstr() {
		return accountstr;
	}
	public void setAccountstr(String accountstr) {
		this.accountstr = accountstr;
	}
	
	public static User getIUserInstance(Context context) {
		if (user == null)
			user = new User();
		sp = context.getSharedPreferences("UserInfo.pre",
 				Activity.MODE_PRIVATE);
    	return user;
	}
  
	public int getState() {
		return sp.getInt("state", -1);
	}

	public void setState(int state) {
		sp.edit().putInt("state", state).commit();
	}
	public String getUserid() {
		return sp.getString("userid", "");
	}

	public void setUserid(String userid) {
		sp.edit().putString("userid", userid).commit();
	}

	public String getIsregister() {
		return sp.getString("isregister", "");
	}

	public void setIsregister(String isregister) {
		sp.edit().putString("isregister", isregister).commit();
	}

	public String getPhonenum() {
		return sp.getString("phonenum", "");
	}

	public void setPhonenum(String phonenum) {
		sp.edit().putString("phonenum", phonenum).commit();
	}

	public int getHeight() {
		return sp.getInt("height", 0);
	}

	public void setHeight(int height) {
		sp.edit().putInt("height", height).commit();
	}

	public String getSex() {
		return sp.getString("sex", "");
	}

	public void setSex(String sex) {
		sp.edit().putString("sex", sex).commit();
	}

	public String getBirthday() {
		return sp.getString("birthday", "");
	}

	public void setBirthday(String birthday) {
		sp.edit().putString("birthday", birthday).commit();
	}

	
	public String getPassword() {
		return sp.getString("password", "");
	}

	public void setPassword(String password) {
		sp.edit().putString("password", password).commit();
	}


	public String getAvatar() {
		return sp.getString("avatar", "");
	}


	public void setAvatar(String avatar) {
		sp.edit().putString("avatar", avatar).commit();
	}public boolean getIs_log_sucess() {
		return sp.getBoolean("is_log_sucess", false);
	}
   
	
	public void setIs_log_sucess(boolean is_log_sucess) {
		sp.edit().putBoolean("is_log_sucess", is_log_sucess).commit();
	}
	
}
